import request from '@/utils/request'

/**
 * 分页获取
 */
export function getMovieByPage(params, pageNum, pageSize, token) {
    return request({
        url: '/movie/list/page',
        method: 'get',
        params: {
            ...params,
            pageNum,
            pageSize,
        },
        headers: {
            'token': token
        }
    })
}

/**
 * 保存
 */
export function addOrUpdateMovie(data, token) {
    return request({
        url: '/movie/addOrUpdate',
        method: 'post',
        params: {
            ...data
        },
        headers: {
            'token': token
        }
    })
}

/**
 * 电影详情
 */
export function getMovieDetail(id, token) {
    return request({
        url: '/movie/getMovieDetail/' + id,
        method: 'get'
    })
}


/**
 * 删除电影信息
 */
export function delMovieById(id, token) {
    return request({
        url: '/movie/delMovieById/' + id,
        method: 'post',
        headers: {
            'token': token
        }
    })
}

/**
 * 获取电影评论
 */
export function getComment(movieId) {
    return request({
        url: '/comment/getComment',
        method: 'get',
        params: {
            movieId: movieId
        }
    })
}

/**
 * 删除电影评论
 */
export function delComment(commentId,token) {
    return request({
        url: '/comment/delComment',
        method: 'post',
        params: {
            commentId: commentId
        },
        headers: {
            'token': token
        }
    })
}

/**
 * 获取电影评分
 */
export function getStartScore(movieId) {
    return request({
        url: '/comment/getStartScore',
        method: 'get',
        params: {
            movieId: movieId
        }
    })
}